/*     */ package com.lmpop.trade.tb_orderstate;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import com.lmpop.trade.tb_commpara.Tb_commparaInfo;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Tb_orderstateInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Tb_orderstateInfo()
/*     */   {
/*  18 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  27 */     String result_code = "0";
/*     */     try
/*     */     {
/*  30 */       RandomID randomID = new RandomID();
/*  31 */       Tb_commparaInfo tb_commparaInfo = new Tb_commparaInfo();
/*  32 */       String order_no = map.getString("order_no");
/*  33 */       String order_state = map.getString("order_state");
/*  34 */       String user_id = "";
/*  35 */       if (map.getString("session_user_id") != null) user_id = map.getString("session_user_id");
/*  36 */       String state_id = randomID.GenTradeId();
/*  37 */       Hashtable sMap = new Hashtable();
/*  38 */       sMap.put("state_id", state_id);
/*  39 */       sMap.put("order_no", order_no);
/*  40 */       sMap.put("state_code", order_state);
/*  41 */       sMap.put("user_id", user_id);
/*  42 */       String state_name = tb_commparaInfo.getOneComparaPcode1("31", order_state);
/*  43 */       sMap.put("state_name", state_name);
/*  44 */       insert(dbmMgr, sMap);
/*     */     }
/*     */     catch (ApplicationException e) {
/*  47 */       e.printStackTrace();
/*  48 */       result_code = "1";
/*     */     }
/*  50 */     map.setString("result_code", result_code);
/*  51 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Hashtable tb_orderstate)
/*     */     throws ApplicationException
/*     */   {
/*  60 */     dbmMgr.update("insertTb_orderstate", tb_orderstate);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  70 */     String pkid_string = map.getString("pkid");
/*  71 */     String result_code = "0";
/*     */     try {
/*  73 */       if (!pkid_string.equals("")) {
/*  74 */         String[] pkStr = pkid_string.split("\\|");
/*  75 */         for (int i = 0; i < pkStr.length; i++) {
/*  76 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  80 */       e.printStackTrace();
/*  81 */       result_code = "1";
/*     */     }
/*  83 */     map.setString("result_code", result_code);
/*  84 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  93 */     dbmMgr.update("deleteTb_orderstate", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 102 */     Tb_orderstate tb_orderstate = new Tb_orderstate();
/* 103 */     tb_orderstate.setState_id(map.getString("state_id"));
/* 104 */     tb_orderstate.setState_type(map.getString("state_type"));
/* 105 */     tb_orderstate.setOrder_id(map.getString("order_id"));
/* 106 */     tb_orderstate.setOrder_detail_id(map.getString("order_detail_id"));
/* 107 */     tb_orderstate.setState_name(map.getString("state_name"));
/* 108 */     tb_orderstate.setState_code(map.getString("state_code"));
/* 109 */     tb_orderstate.setState_date(map.getString("state_date"));
/* 110 */     tb_orderstate.setRsrv_str1(map.getString("rsrv_str1"));
/* 111 */     tb_orderstate.setRsrv_str2(map.getInt("rsrv_str2"));
/* 112 */     tb_orderstate.setRsrv_str3(map.getString("rsrv_str3"));
/* 113 */     tb_orderstate.setIn_date(map.getString("in_date"));
/* 114 */     tb_orderstate.setUser_id(map.getString("user_id"));
/* 115 */     tb_orderstate.setRemark(map.getString("remark"));
/*     */ 
/* 117 */     String result_code = "0";
/*     */     try {
/* 119 */       update(dbmMgr, tb_orderstate);
/*     */     } catch (ApplicationException e) {
/* 121 */       e.printStackTrace();
/* 122 */       result_code = "1";
/*     */     }
/* 124 */     map.setString("result_code", result_code);
/* 125 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Tb_orderstate tb_orderstate)
/*     */     throws ApplicationException
/*     */   {
/* 134 */     dbmMgr.update("updateTb_orderstate", tb_orderstate);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 144 */     Map params = (Hashtable)obj;
/* 145 */     if (start == 0)
/* 146 */       start = 0;
/*     */     else {
/* 148 */       start = (start - 1) * limit;
/*     */     }
/* 150 */     params.put("start", Integer.valueOf(start));
/* 151 */     params.put("limit", Integer.valueOf(limit));
/*     */ 
/* 153 */     return this.queryList.getList("getListByTb_orderstatePage", params);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 164 */     Hashtable params = (Hashtable)obj;
/* 165 */     List list = this.queryList.getList("getCountByObjTb_orderstate", params);
/* 166 */     int count = 0;
/* 167 */     if ((list != null) && (list.size() > 0)) {
/* 168 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 169 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 170 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 173 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 183 */     return this.queryList.getList("getTb_orderstateByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.tb_orderstate.Tb_orderstateInfo
 * JD-Core Version:    0.6.0
 */